/**
 * BBD Service Inc
 * All Rights Reserved @2018
 */
package com.bbd.merchant.guide.galaxy.roman;

import org.apache.commons.lang3.StringUtils;

/**
 * Roman符号枚举类
 *
 * @author tianyuliang
 * @version $Id: RomanSymbolEnum.java, v0.1 2018-08-01 11:31 tianyuliang Exp $$
 */
public enum RomanSymbolEnum {

    I("I", 1),

    V("V", 5),

    X("X", 10),

    L("L", 50),

    C("C", 100),

    D("D", 500),

    M("M", 1000);

    /**
     * Roman符号
     */
    private String  symbol;

    /**
     * 10进制数
     */
    private Integer number;

    /***
     * 构造方法
     * @param symbol
     * @param number
     */
    RomanSymbolEnum(String symbol, Integer number) {
        this.symbol = symbol;
        this.number = number;
    }

    /**
     * 货币字符串 转化为 货币枚举
     * @param symbol
     * @return
     */
    public static RomanSymbolEnum of(String symbol) {
        if (StringUtils.isBlank(symbol)) {
            return null;
        }
        for (RomanSymbolEnum symbolEnum : RomanSymbolEnum.values()) {
            if (symbolEnum.symbol.equals(symbol)) {
                return symbolEnum;
            }
        }
        return null;
    }

    public String getSymbol() {
        return symbol;
    }

    public Integer getNumber() {
        return number;
    }
}
